info = {
    "stu1801":"ziqi",
    "stu1802":"xiaofeng",
    "stu1803":"LiuYu",
    }
print(info)

>>> dict = {'name':'zara','age':7,'class':'first'}
>>> print("dict['name']:",dict['age'])
dict['name']: 7

>>> dict['age'] = 8
>>> dict['school'] = "RUMOOB"
>>> print("dict['school']:",dict['school'])
dict['school']: RUMOOB

>>> del dict['name']
>>> dict
{'age': 8, 'class': 'first', 'school': 'RUMOOB'}

>>> del dict
>>> dict
<class 'dict'>
>>> str(dict)
"{'name': 'zara', 'age': 7}"
>>> str(dict)[0]
'{'

>>> dict = {'name':'zara','age':7}
>>> len(dict)
2
>>> dict1 = {'name':'zara','age':7,'class':'first'}
>>> len(dict1)
3

fruits = {}
fruits ["apples"] = 10
if "bananas" not in fruits:
    fruits ["bananas"] =0
fruits ["bananas"]+=1
print(fruits)

found = {}
found ["a"]= 0
found ["e"]= 0
found ["i"]= 0
found ["o"]= 0
found ["u"]= 0
print(found)
for k,v in sorted(found.items()):
    print(k,"is found",v,"time(s).")

>>> apple = {}
>>> apple["name"] = "youge"
>>> apple["Gender"] = "male"
>>> apple["age"] = 30
>>> apple
{'name': 'youge', 'Gender': 'male', 'age': 30}

>>> fruits = {}
>>> fruits ["apples"] = 10
>>> fruits.setdefault("bananas",0)
0
>>> fruits ["bananas"]+=1
>>> print(fruits)
{'apples': 10, 'bananas': 1}

>>> a = {"a","e","i","u","o"}
>>> word = "hello"
>>> u = a.union(set(word))
>>> u
{'e', 'h', 'l', 'i', 'u', 'a', 'o'}
>>> b = a.difference(set(word))
>>> b
{'i', 'u', 'a'}
>>> c = a.intersection(set(word))
>>> c
{'e', 'o'}

>>> a = {"a","e","e","i","o","u","u"}
>>> a
{'e', 'i', 'u', 'a', 'o'}
>>> a = set("aeeiouu")
>>> a
{'e', 'i', 'u', 'a', 'o'}
>>> b = sorted(list(a))
>>> b
['a', 'e', 'i', 'o', 'u']

#### 猜数字
```
import random
hide_card = random.randint(1,100)
count = 0
if hide_card <100 and hide_card >0:
    while True:
        if count <5:
            guess = input("请输入你猜想的数字")
            guess_digit = int(guess)
            if guess_digit == hide_card:
               print("恭喜你，猜中了")
               break
            elif guess_digit>hide_card:
                print("你猜的数字太大了")
            else:
                print("你猜的数字太小了")
            count +=1
        else:
            print("猜这么多都猜不对")
            print("正确答案:%s"%(hide_card))
            break
else:
    print("请输入数字在0-99之间的数字")

person3 = {'name':'mike',
           'gender':'male',
           'occupation':'researcher',
           'home planet':'betelgeuse seven'}
print(person3)

#print(person3)
print(person3['home planet'])
print(person3['name'])
person3['age'] = 33
print(person3)

found = {}
print(found)
found['a'] = 0
found['e'] = 0
found['i'] = 0
found['o'] = 0
found['u'] = 0
print(found)
found['e'] = found['e'] +1
found['e'] = found['e'] +1
for k in found:
    print(k,'was found',found[k],'time(s).')

for k,v in sorted(found.items()) :
    print(k,'was found',v,'time(s).')

vowels = {'a','e','e','i','o','u','u'}
word = input("Provide a word to search for vowels:")
found = []
for letter in word:
    if letter in vowels:
        if letter not in found:
            found.append(letter)
for vowels in found:
    print(vowels)

vowels = {'a','e','e','i','o','u','u'}
print(vowels)

voweles2 = set('aeeiouu')
print(voweles2)

voweles2 = set('aeeiouu')
word = 'hello'
u = voweles2.union(set(word))
u_list = sorted(list(u))
print(u)

d = voweles2.difference(set(word))
print(d)


i = voweles2.intersection(set(word))
print(i)

vowels =set('aeiou')
word = input('Provide a word to search for vowels:')
found = vowels.intersection(set(word))
for vowels in found:
    print(vowels)

vowels = ['a','e','i','o','u']
print(type(vowels))
vowels1 = ('a','e','i','o','u')
print(type(vowels1))
vowels[2] = 'I'
print(vowels)

t = ('Python')
print(type(t))
print(t)
t2 =('python',)
print(type(t2))
print(t2)

people = {}
people['ford'] = {'name':'ford prefect',
           'gender':'male',
           'occupation':'researcher',
           'home planet':'batelgeuse seven'}
people['arthur'] = {'name':'arthur dent',
           'gender':'male',
           'occupation':'sandwich-maker',
           'home planet':'earth'}
people['trillian'] = {'name':'tricia mcmillan',
           'gender':'female',
           'occupation':'mathematician',
           'home planet':'earth'}
people['robot'] = {'name':'marvin',
           'gender':'unkown',
           'occupation':'paranoid android',
           'home planet':'unknow'}
import pprint
pprint.pprint(people)
print(people['arthur']['occupation'])

- [微软字典练习](https://gitee.com/zhengzhiqing/deml/blob/master/week07/%E5%BE%AE%E8%BD%AF%E5%AD%97%E5%85%B8%E6%9F%A5%E8%AF%A2%E7%BB%83%E4%B9%A0.md)

- [字典集合笔记](https://gitee.com/zhengzhiqing/deml/blob/master/week07/%E5%AD%97%E5%85%B8%EF%BC%8C%E9%9B%86%E5%90%88%E7%AC%94%E8%AE%B0.md)